﻿<UserControl
    x:Class="Coproject.Views.LoggingView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:dg="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
    cal:Bind.Model="LoggingViewModel"
    mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="600"
    >
    
    <d:DesignProperties.DataContext>
        <Binding Path="LoggingViewModel" Source="{StaticResource ViewModelLocator}"/>
    </d:DesignProperties.DataContext>
    
    <!-- Caliburn View-First -->
    
    <dg:DataGrid x:Name="dataGrid" Margin="10" IsReadOnly="True" GridLinesVisibility="All"
                           AutoGenerateColumns="False"
                           VerticalContentAlignment="Stretch" Width="Auto" 
                           HorizontalContentAlignment="Stretch" Height="Auto" 
                           ItemsSource="{Binding TraceMessages}"
                           >
        <dg:DataGrid.Columns>

            <dg:DataGridTemplateColumn Header="Id">
                <dg:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Id}" TextWrapping="Wrap" FontSize="11"  Margin="5"/>
                    </DataTemplate>
                </dg:DataGridTemplateColumn.CellTemplate>
            </dg:DataGridTemplateColumn>

            <dg:DataGridTemplateColumn Header="Timestamp">
                <dg:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Timestamp}" TextWrapping="Wrap" FontSize="11"  Margin="5"/>
                    </DataTemplate>
                </dg:DataGridTemplateColumn.CellTemplate>
            </dg:DataGridTemplateColumn>

            <dg:DataGridTemplateColumn Header="UserName">
                <dg:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding UserName}" TextWrapping="Wrap" FontSize="11"  Margin="5"/>
                    </DataTemplate>
                </dg:DataGridTemplateColumn.CellTemplate>
            </dg:DataGridTemplateColumn>

            <dg:DataGridTemplateColumn Header="Source">
                <dg:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Source}" Width="300" TextWrapping="Wrap" FontSize="11"  Margin="5"/>
                    </DataTemplate>
                </dg:DataGridTemplateColumn.CellTemplate>
            </dg:DataGridTemplateColumn>

            <dg:DataGridTemplateColumn Header="Message">
                <dg:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Message}" Width="600" TextWrapping="Wrap" FontSize="11"  Margin="5"/>
                    </DataTemplate>
                </dg:DataGridTemplateColumn.CellTemplate>
            </dg:DataGridTemplateColumn>

        </dg:DataGrid.Columns>
    </dg:DataGrid>
</UserControl>
